#include "Scene09.hpp"

Scene09::Scene09() {
    b2Vec2 vertices[8];
    vertices[0].Set(-8.55f, -5.0f);
    vertices[1].Set(8.55f, -5.0f);
    vertices[2].Set(8.55f, -3.0f);
    vertices[3].Set(6.55f, -3.0f);
    vertices[4].Set(6.55f, 5.0f);
    vertices[5].Set(-6.55f, 5.0f);
    vertices[6].Set(-6.55f, -3.0f);
    vertices[7].Set(-8.55f, -3.0f);

    this->createRoom(9, vertices, 8);

    b2Vec2 platform1Vertices[3];
    platform1Vertices[0].Set(-6.55f, 2.0f);
    platform1Vertices[1].Set(-5.55f, 1.0f);
    platform1Vertices[2].Set(-4.55f, 1.0f);

    this->createPlatform(platform1Vertices, 3);

    b2Vec2 platform2Vertices[3];
    platform2Vertices[0].Set(3.55f, 1.0f);
    platform2Vertices[1].Set(5.55f, 1.0f);
    platform2Vertices[2].Set(6.55f, 2.0f);

    this->createPlatform(platform2Vertices, 3);

    this->start = this->createDoor(-6.55f, -4.0f, -1.0f);
    this->createExit(7.55f, -4.0f);
    this->hero = this->createHero(-8.55f + HeroElement::WIDTH / 2.0f, -5.0f + HeroElement::HEIGHT / 2.0f);

    // First light.
    SpotlightElement* firstLight = this->createSpotlight(-5.55f, 4.5f, - b2_pi / 3.0f, b2_pi / 7.0f, 13.0f, LightElement::attractiveLight);
    this->createSwitch(4.55f, -5.0f, 0.0f, firstLight);
    this->createBox(4.55f, -4.5f);

    // Second light.
    SpotlightElement* secondLight = this->createSpotlight(-6.05f, 0.5f, 11.0f * b2_pi / 45.0f, b2_pi / 7.0f, 9.0f, LightElement::repulsiveLight);
    secondLight->supportBarDirection->Set(-1.0f, 0.0f);
    this->createSwitch(-3.05f, -5.0f, 0.0f, secondLight);

    // Third light.
    SpotlightElement* thirdLight = this->createSpotlight(6.05f, 0.5f, b2_pi - 11.0f * b2_pi / 45.0f, b2_pi / 7.0f, 9.0f, LightElement::attractiveLight);
    thirdLight->supportBarDirection->Set(11.0f, 0.0f);
    this->createSwitch(-0.85f, -5.0f, 0.0f, thirdLight);

    // Exit door.
    this->exit = this->createDoor(6.55f, -4.0f, 1.0f);
    this->createSwitch(4.55f, 1.0f, 0.0f, this->exit);
}
